package pixelradar.forge;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import pixelradar.Mw;
import pixelradar.api.MwAPI;
import pixelradar.config.ConfigurationHandler;
import pixelradar.overlay.OverlayGrid;
import pixelradar.overlay.OverlaySlime;
import pixelradar.region.MwChunk;

import java.io.File;

public class ClientProxy extends CommonProxy {
    public void preInit(File configFile) {
        ConfigurationHandler.init(configFile);
        MinecraftForge.EVENT_BUS.register(new ConfigurationHandler());
    }

    public void load() {
        EventHandler eventHandler = new EventHandler(Mw.getInstance());
        MinecraftForge.EVENT_BUS.register(eventHandler);
        MwKeyHandler keyEventHandler = new MwKeyHandler();
        MinecraftForge.EVENT_BUS.register(keyEventHandler);
    }

    public void postInit() {
//        if (Loader.isModLoaded("VersionChecker")) {
//            FMLInterModComms.sendRuntimeMessage("pixelradar", "VersionChecker", "addVersionCheck", "https://goo.gl/T20VFb");
//        } else {
//            VersionCheck versionCheck = new VersionCheck();
//            Thread versionCheckThread = new Thread(versionCheck, "Version Check");
//            versionCheckThread.start();
//        }

        if (Loader.isModLoaded("CarpentersBlocks")) {
            MwChunk.carpenterdata();
        }

        if (Loader.isModLoaded("ForgeMultipart")) {
            MwChunk.FMPdata();
        }

        MwAPI.registerDataProvider("Slime", new OverlaySlime());
        MwAPI.registerDataProvider("Grid", new OverlayGrid());
    }
}
